package com.demo.designmode.adapter.objectadapter;

import com.demo.designmode.adapter.classadapter.SDCard;
import com.demo.designmode.adapter.classadapter.TFCard;

/**
 * @Author: jxm
 * @Description: 创建适配器对象（SD兼容TF）
 * @Date: 2023-12-13 9:55
 * @Version: 1.0
 */
public class SDAdapterTF implements SDCard {

    private TFCard tfCard;

    public SDAdapterTF(TFCard tfCard) {
        this.tfCard = tfCard;
    }

    @Override
    public String readSD() {
        System.out.println("adapter read tf card ");
        return tfCard.readTF();
    }

    @Override
    public void writeSD(String msg) {
        System.out.println("adapter write tf card");
        tfCard.writeTF(msg);
    }
}
